package priv.lhy.activity.services.processor.reward;

import org.springframework.stereotype.Service;
import priv.lhy.activity.services.processor.AbstractRewardProcessor;
import priv.lhy.activity.services.processor.ActivityDrawContext;
import priv.lhy.activity.services.processor.constants.DrawContants;

/**
 * author : lihy
 * date : 2019/2/16 15:02
 */
@Service("financeRewardProcessor")
public class FinanceRewardProcessor extends AbstractRewardProcessor {
    @Override
    protected void afterProcessor(ActivityDrawContext activityDrawContext) {
        //TODO 后续操作，短信、邮件等等
        System.out.println(activityDrawContext.getActivityTurntableDrawReq().getUid() + "用户，恭喜您获得奖品:" + activityDrawContext.getActDrawAwardItem().getItemName());
    }

    @Override
    protected void processor(ActivityDrawContext activityDrawContext) {
        LOGGER.info("用户：{}，获得奖项:{}", activityDrawContext.getActivityTurntableDrawReq().getUid(), activityDrawContext.getActDrawAwardItem().getItemName());
        //TODO 发放奖品
        //保存记录
        modifyAwardRecord(activityDrawContext);
    }

    @Override
    protected int getAwardType() {
        return DrawContants.award_type_enum.FINANCE.getValue();
    }
}
